//
//  LHRecommendCityViewController.m
//  Knight_Tour
//
//  Created by Bruce_Lin on 15/5/13.
//  Copyright (c) 2015年 TouchOne. All rights reserved.
//

#import "LHRecommendCityViewController.h"
#import "LHRecommedCityCollectionView.h"
#import "LHRecommendCityHomePageViewController.h"
#import "LHRecommendCityModel.h"
#import "MyNavgationView.h"



@interface LHRecommendCityViewController ()<jumpPassValueDelegate>



@end

@implementation LHRecommendCityViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.title = @"推荐城市列表";
    
    self.navigationController.navigationBar.translucent = NO;
    self.navigationController.navigationBarHidden = YES;
    self.automaticallyAdjustsScrollViewInsets = NO;
    
    [self createRecommendCityCollectionView];
    [self createNavigation];
    
    self.view.backgroundColor = [UIColor colorWithRed:0.871 green:0.962 blue:0.965 alpha:1.000];
}



// 创建自定义导航栏
- (void)createNavigation
{
    MyNavgationView *myNaView = [[MyNavgationView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 64)];
    [myNaView creatTitle:@"推荐城市"];
    
    myNaView.leftAction = @selector(backToHomePageController);
    myNaView.leftTarget = self;
    
    [myNaView creatLeftButtonWithImage:@"btn_nav_back"];
    
    [self.view addSubview:myNaView];
    
    [myNaView release];
    
}
- (void)backToHomePageController
{
    
    [self.navigationController popViewControllerAnimated:YES];
    
}

/**
 *  创建推荐城市页面
 */

- (void)createRecommendCityCollectionView
{

    
    LHRecommedCityCollectionView *recommendCity = [[LHRecommedCityCollectionView alloc] initWithFrame:CGRectMake(0, 64, self.view.frame.size.width, self.view.frame.size.height - 64 - 10)];
   
    recommendCity.delegate = self;
    
    [self.view addSubview:recommendCity];
    
    [recommendCity release];
}

// 实现协议方法
- (void)jumpToNextPageWithIndexPath:(NSIndexPath *)indexPath cityArr:(NSMutableArray *)cityArr
{
    LHRecommendCityHomePageViewController *cityHomeVC = [[[LHRecommendCityHomePageViewController alloc] init] autorelease];
    
    cityHomeVC.cityName = [cityArr[indexPath.item] name];
    
    cityHomeVC.cityIDstr = [cityArr[indexPath.item] cityId];
    
    cityHomeVC.city_Arr = cityArr[indexPath.row];
    
    cityHomeVC.hidesBottomBarWhenPushed = YES;
    
    [self.navigationController pushViewController:cityHomeVC animated:YES];
    

    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
